package com.zwj.learning.timetable.common;

import com.zwj.learning.timetable.constant.RedisKey;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.Resource;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class TokenThreadLocal {

    private static ThreadLocal<String> threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     * @param token
     */
    public static void setCurrentToken(String token){

        threadLocal.set(token);
    }

    /**
     * 获取值
     * @return
     */
    public static String getCurrentToken(){

        return threadLocal.get();
    }
}
